#!/usr/bin/python
# -*- coding: utf-8 -*-

# Decorator class
class Decorator(object):
    def __init__(self, obj):
        self.obj = obj
        
    def __getattr__(self, attr):
        return getattr(self.obj, attr)


# singleton declaration
# Example usage:
#@singleton
#class MySingletonClass(object):
#    def __init__(self):
#        pass
#    def my_method(self):
#        pass
#
# MySingletonClass is now a singleton !
# ------------------------------------- 

def singleton(cls):
    instances = {}
    def get_instance():
        if cls not in instances:
            instances[cls] = cls()
        return instances[cls]
    return get_instance